let path = require("path");
function resolve(dir) {
  return path.join(__dirname, dir);
}

module.exports = {
  //是否开启eslint
  lintOnSave: false,
  devServer: {
    // 默认端口号
    port: 8088,
    proxy: {
      "/xtbg": {
        target: "http://192.168.1.63:21", //对应自己的接口
        changeOrigin: true,
        ws: true,
        // pathRewrite: {
        //   "^/xtbg": "",
        // },
      },
    },
  },

  chainWebpack: (config) => {
    config.resolve.alias
      .set("@", resolve("src"))
      .set("assets", resolve("src/assets"))
      .set("components", resolve("src/components"))
      .set("views", resolve("src/views"))
      .set("network", resolve("src/network"))
      .set("config", resolve("src/config"))
      .set("common", resolve("src/common"))
      .set("plugins", resolve("src/plugins"));
    config.module
      .rule("scss")
      .test(/\.scss$/)
      .oneOf("vue")
      .use("px2rem-loader")
      .loader("px2rem-loader")
      .before("postcss-loader") // this makes it work.
      .options({ remUnit: 80, remPrecision: 24 })
      .end();
  },
  publicPath: process.env.NODE_ENV === "production" ? "/XTBG" : "",
};
